from rest_framework import serializers
from .models import ImagePath, InputSourceType, InputSourceUSB, InputSourceNetworkStream, VideoPath
from django.contrib.auth import get_user_model

User = get_user_model()

class InputSourceTypeSerializer(serializers.ModelSerializer):
    # 这是一个可选字段
    name = serializers.CharField(required=False)
    class Meta:
        model = InputSourceType
        fields = '__all__'
        read_only_fields = ['upload_date']


class InputSourceUSBSerializer(serializers.ModelSerializer):
    # 这是一个可选字段
    name = serializers.CharField(required=False)

    class Meta:
        model = InputSourceUSB
        fields = '__all__'
        read_only_fields = ['upload_date']

class InputSourceNetworkStreamSerializer(serializers.ModelSerializer):
    # 这是一个可选字段
    name = serializers.CharField(required=False)

    class Meta:
        model = InputSourceNetworkStream
        fields = '__all__'
        read_only_fields = ['upload_date']
         
class VideoPathSerializer(serializers.ModelSerializer):
    # 这是一个可选字段
    videopath = serializers.CharField(required=False)

    class Meta:
        model = VideoPath
        fields = '__all__'
        # read_only_fields = ['upload_date']

class ImagePathSerializer(serializers.ModelSerializer):
    # 这是一个可选字段
    imagepath = serializers.CharField(required=False)

    class Meta:
        model = ImagePath
        fields = '__all__'
        # read_only_fields = ['upload_date']